﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace DARE
{
    public class CDirectionalParticleData: CParticleData
    {
        public float LifeTime { get; set; }
        public float FadeInDuration { get; set; }
        public float FadeOutDuration { get; set; }
        public Color InitialColor { get; set; }
        public Color FinalColor { get; set; }
        public Vector2 InitialSize { get; set; }
        public Vector2 FinalSize { get; set; }
        public string Texture { get; set; }
        public Vector3 Forces { get; set; }


        public override void FillDataStructure(object p)
        {
            IParticle particle = p as IParticle;
            base.FillDataStructure(particle);
            LifeTime = (particle as CDirectionalParticle).LifeTime;
            FadeInDuration = (particle as CDirectionalParticle).FadeInDuration;
            FadeOutDuration = (particle as CDirectionalParticle).FadeOutDuration;
            InitialColor = (particle as CDirectionalParticle).InitialColor;
            InitialSize = (particle as CDirectionalParticle).InitialSize;
            FinalColor = (particle as CDirectionalParticle).FinalColor;
            FinalSize = (particle as CDirectionalParticle).FinalSize;
            Forces = (particle as CDirectionalParticle).Forces;
            Texture = CResourceMgr.GetResourceName((particle as CDirectionalParticle).Texture);
        }

        public override void FillFromDataStructure(out object p, params object[] paramsData)
        {
            base.FillFromDataStructure(out p);
            IParticle particle = p as IParticle;
            (particle as CDirectionalParticle).LifeTime = LifeTime;
            (particle as CDirectionalParticle).FadeInDuration = FadeInDuration;
            (particle as CDirectionalParticle).FadeOutDuration = FadeOutDuration;
            (particle as CDirectionalParticle).InitialColor = InitialColor;
            (particle as CDirectionalParticle).InitialSize = InitialSize;
            (particle as CDirectionalParticle).FinalColor = FinalColor;
            (particle as CDirectionalParticle).FinalSize = FinalSize;
            (particle as CDirectionalParticle).Forces = Forces;
            (particle as CDirectionalParticle).Texture = CResourceMgr.Load<Texture2D>(Texture);
        }

        public override IParticle CreateParticle()
        {
            return new CDirectionalParticle();
        }
    }
}
